redhat7 配置使用centos的yum源
新安装了redhat7.安装后,登录系统,使用yum update 更新系统。提示:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
无法更新。
redhat 默认自带的 yum 源需要注册,才能更新。我们想不花钱也可以更新,需要替换掉redhat的yum源。
1.检查是否安装yum包
查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:
[root@syq yum.repos.d]# rpm -qa |grep yum
yum-3.4.3-118.el7.noarch
yum-utils-1.1.31-24.el7.noarch
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
2 删除redhat自带的yum包
卸载上面显示的所有yum包:
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
再用
[root@localhost ~]# rpm -qa |grep yum
[root@localhost ~]#
查看,无信息显示表示已经卸载完成。
3.下载新的yum包。使用Centos7的yum包
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-3.4.3-158.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.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/rpm-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm ( rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps )
安装yum软件包
注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把yum-plugin-fastestmirror强制安装
rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps rpm -Uvh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm --nodeps rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm rpm -ivh yum-utils-1.1.31-45.el7.noarch.rpm rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm
4.更换yum源。使用阿里云的源
第一步:备份你的原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更改CentOS-Media.repo使其为不生效:
enabled=0
或者用163.com我是用的163.com的方法,
# 写 yum 配置文件
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
*********************************************************************
yum clean all
第三步:修改CentOS-Base.repo文件中的$releasever全部替换为版本号7. 第四步:运行yum makecache生成缓存
yum clean all
yum makecache
yum update
注本文来源于https://www.cnblogs.com/syqlp/p/6555524.html 博主用的阿里云yum源 我用的是163.com
redhat7 配置使用centos的yum源的更多相关文章
- redhat6.5 配置使用centos的yum源
新安装了redhat6.5安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Ma ...
- centos配置ADSL拨号 配置阿里云的yum源
如果系统yum源有问题可以更改yum源配置阿里云的yum源1)下载repo文件 wget http://mirrors.aliyun.com/repo/Centos-7.repo(没有 wget命令可 ...
- CentOS使用yum源中自带的rpm包安装LAMP环境
CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...
- Red Hat6设置使用CentOS的yum源
环境查看 red hat系统使用自己默认的yum源未注册在使用yum安装软件的时候会出现以下错误提示 可以修改成centos的yum源 卸载yum软件 rpm -qa|grep yum|xargs r ...
- [转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源
Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags ...
- CentOS EPEL yum源
CentOS EPEL yum源 用yum安装软件时,经常发现我们的yum源里面没有该软件,比如htop.网上查到的一个方案是需要自己去wget源码,然后configure,make,make ins ...
- 配置本机的yum源
配置本机的yum源 环境:操作系统CentOS6.5 1.挂在安装光盘 [root@CentOS40 ~]# mkdir -p /mnt/cdrom[root@CentOS40 ~]# mount / ...
- CentOS更新yum源
CentOS更新yum源 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2.下载 ...
- Centos更换yum源
Centos更换yum源 步骤如下: 备份原始源 cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/ ...
随机推荐
- bbs论坛流程
1.发表帖子时候操作 数据库: board+板块号 :readertopicsX中插入数据 boardtmp(临时表插入审核数据) countandmax(记录每个板块最大主贴ID) 一. Redis ...
- 《ABCD组》第一次作业:团队亮相
ABCD组:团队亮相 项目 内容 这个作业属于哪个课程 http://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nw ...
- Java反射机制概念及应用场景
Java的反射机制相信大家在平时的业务开发过程中应该很少使用到,但是在一些基础框架的搭建上应用非常广泛,今天简单的总结学习一下. 1. 什么是反射机制? Java反射机制是在运行状态中,对于任意一个类 ...
- 基于ROS的分布式机器人远程控制平台
基于ROS的分布式机器人远程控制平台 1 结构说明 HiBot架构主要使用C/S架构,其中HibotServer为服务器,Muqutte为消息服务器中间件,HiBotClient为运行在机器人上的 ...
- what's the 白盒测试
what's the 白盒测试 白盒测试又称结构测试.透明盒测试.逻辑驱动测试或基于代码的测试.盒子指的是被测试的软件,白盒指的是盒子是可视的,你清楚盒子内部的东西以及里面是如何运作的.白盒要考虑测试 ...
- git reset与git revert的区别
http://alpha-blog.wanglianghome.org/2010/07/30/git-partial-rollback/ reset(版本撤回) 格式 git reset [-q] [ ...
- deviceMotion.userAcceleration加速度方向
ios坐标系如图中所示,假设手机受到1个沿X正方向的力(假设该力产生了1m/s^2的加速度),那么deviceMotion.userAcceleration的值为多少呢? 答案是违反常识的:devic ...
- VMVare的窗口自适应
啊!好久没来博客园了.原因很简单,我把密码丢了. 最近才从系统申请重置了密码,这不,又能登录了.你可能好奇,是的,我也在疑惑:我是不是搞IT的啊?因为只要密码丢失,我就认为世界完蛋了,我完蛋了:) 这 ...
- cnblog项目--20190309
第一个真正意义的Django项目 ! 预计时间5天 20190309--20190314 目标:学会Django的使用,理解模块关系! querset 相当于一个存放列表的字典 day ...
- springMVC--annotation
一 解析类 ComponentScanBeanDefinitionParser component-scan标签解析类 component-scan 兼容 annotation-config ,因此前 ...