配置Redhat7使用centos7 的yum源

1.首先查看redhat7系统本身所安装的那些yum软件包

root@linux \~\]# 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-118.el7.noarch (随版本更新名字可能会不一样) 2.删除redhat自带的yum包,卸载上面显示的所有yum包: \[root@localhost \~\]# rpm -qa\|grep yum\|xargs rpm -e --nodeps \[root@localhost \~\]# rpm -qa \|grep yum 或者 rpm -e 包名 --nodeps 3.保证本机电脑能上网,ping一下 4.选择网络源 网易,阿里云都可以 网易:欢迎访问网易开源镜像站 阿里云:阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 5.下载安装包rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.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-54.el7_8.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm 6.查看下载完成结果 \[root@linux \~\]# ll 7.安装软件包 \[root@linux \~\]# rpm -ivh yum-\* 若安装失败出现以下 warning: package yum-metadata-parser-1.1.4-10.el7.x86_64 was already added, skipping yum-metadata-parser-1.1.4-10.el7.x86_64 error: Failed dependencies: rpm \>= 0:4.11.3-22 is needed by yum-3.4.3-168.el7.centos.noarch 则还需要下载rpm安装包更新一下版本 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm 下载之后先安装更新rpm包再安装软件包 8.新建repo配置文件,直接复制粘贴以下内容 \[root@linux \~\]# 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

9.测试安装是否正常

root@linux \~\]# yum -y install 包名 ------------------------------------------------ 版权声明:本文为CSDN博主「croft12138」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/croft12138/article/details/130532149

相关推荐
阿星智力囊1 小时前
Thinkphp6+nginx环境报错信息不显示,接口直接报500和CORS跨域(错误的引导方向),真坑啊
运维·nginx·php·thinkphp6
代码AC不AC2 小时前
【Linux】计算机的基石:从冯·诺依曼体系结构到操作系统管理
linux·操作系统·冯诺依曼体系结构
大柏怎么被偷了3 小时前
【Linux】进程等待
linux·运维·服务器
云和数据.ChenGuang4 小时前
运维面试题之oracle和mysql单表最大容量
运维·mysql·oracle
互联网老欣4 小时前
2025年保姆级教程:阿里云服务器部署Dify+Ollama,打造专属AI应用平台
服务器·阿里云·ai·云计算·dify·ollama·deepseek
偶像你挑的噻4 小时前
12-Linux驱动开发- SPI子系统
linux·驱动开发·stm32·嵌入式硬件
酷柚易汛智推官4 小时前
Fastlane赋能移动研发:从全流程自动化到工程效能升级
运维·自动化·酷柚易汛
落798.4 小时前
Genlogin × Bright Data,一键解锁自动化采集的高成功率方案
运维·自动化·数据采集·亮数据
羑悻的小杀马特4 小时前
轻量跨云·掌控无界:Portainer CE + cpolar 让远程容器运维像点外卖一样简单——免复杂配置,安全直达对应集群
运维·网络·安全·docker·cpolar
松涛和鸣4 小时前
16、C 语言高级指针与结构体
linux·c语言·开发语言·数据结构·git·算法