RedHat换源
1、卸载redhat源
# 查看已安装yum
rpm -qa | grep yum
[fhu@vmachine ~]$ rpm -qa | grep yum
PackageKit-yum-1.1.10-2.el7.centos.x86_64
yum-plugin-fastestmirror-1.1.31-53.el7.noarch
yum-rhn-plugin-2.0.1-10.el7.noarch
yum-3.4.3-167.el7.centos.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-utils-1.1.31-53.el7.noarch
yum-langpacks-0.4.2-7.el7.noarch
# 卸载
[fhu@vmachine ~]$ rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch --nodeps
[fhu@vmachine ~]$ rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[fhu@vmachine ~]$ rpm -e yum-3.4.3-158.el7.noarch --nodeps
...
或
# 一键卸载
rpm -qa | grep yum | xargs rpm -e --nodeps
2、下载yum软件包
-
阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
-
网易163网络源地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
-
CentOS网络源地址:http://centos.ustc.edu.cn/centos/
如果Not found,可能是源文件已更新,请去源网站中查询具体版本号
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
3、安装yum软件包
# 因为安装会有依赖的问题,所以加上--force参数强制安装
[root@vmachine ~]$ rpm -ivh yum-* --force --nodeps
4、创建yum配置文件
下载阿里镜像到/etc/yum.repos.d/目录下
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 修改Centos-7.repo文件 将所有$releasever替换为7
vim /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/7/g
5、运行yum makecache命令生成缓存
[root@vmachine ~]$ yum clean all
[root@vmachine ~]$ yum makecache
注意:
如果一直提示以下错误,是因为redhat自带的插件subscription-manager给弄得的。而这个插件的作用就是Red Hat Subscription Manager订阅管理器,就是它让你一直register
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
# 禁用该插件
[root@vmachine ~]$ vim /etc/yum/pluginconf.d/subscription-manager.conf
# 将enabled改为0
[main]
enabled=0
6、关闭防火墙
[root@vmachine ~]$ systemctl stop firewalld.service
[root@vmachine ~]$ systemctl disable firewalld.service
博客内容仅供参考,部分参考他人优秀博文,仅供学习使用
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
2018-08-23 面向对象(五)——isinstance与issubclass、反射、内置方法