redhat7.5更改yum源

背景:redhat7.5的yum服务是付费的,就无法愉快的使用yum安装软件,所以采取了替换为CentOs的yum工具

1.登录redhat查看yum

rpm -qa |grep yum

2.卸载yum

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

3.下载安装centos7的yum依赖

http://mirrors.163.com/centos/7/os/x86_64/Packages/

从上边的地址下载如下包,然后安装 rpm -ivh yum-* python-*

rpm -ivh yum-* 如果报错

选择一起安装, rpm -ivh  依赖的安装包  依赖的安装包1

检查是否安装成功 rpm -qa | grep yum 

4.新建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=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=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=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

5.清除缓存:

yum clean all 

6.测试下yum是否可用

安装个wget试试,安装成功即可

以上~

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1)备份原有的默认yum源 [root@bastion-IDC ~]# cp /etc/yum.repos.d/C...
    SkTj阅读 4,692评论 0 0
  • 说明:此测试环境用Red Hat Enterprise Linux 5.4 作为测试机,同理,本文理论上可以解决关...
    3hua阅读 5,590评论 0 0
  • 目前,我们常见的系统大概就是Windows、Linux和Mac OS了。Windows系统应该是大部分人最早开始接...
    twintwin阅读 4,771评论 0 1
  • 秋之寂,树之哀 楚天阔,风城衰 败落千百余里,独唏坠叶 恍惚风旗马轨,唯嗟心猿 飒飒红枫依依落 浮生一梦皆魍魉 半...
    神音竹阙阅读 876评论 0 0
  • 今天是星期四,我家养了一只大金毛,它的皮是黄色的。今年他才刚一岁,很大很大。而且那是狗还是男的。人家说不能摸它的头...
    快乐_c0d8阅读 1,131评论 0 1